package org.hawk.gwtppc.webtest.tests.mock;

import java.lang.reflect.Method;

public class TargetValidatorMgr {

	private final String PACKAGEPATCH = "org.hawk.gwtppc.webtest.tests.mock";
	private final String POSTFIX = "ValidatorMgr";

	private static TargetValidatorMgr _instance;

	public TargetValidatorMgr getInstance() {
		if (_instance == null)
			_instance = new TargetValidatorMgr();
		return _instance;
	}

	/**
	 * @param servType
	 * @param servId
	 * @return
	 */
	public String validate(String servType, String servId) {
		String msg = null;
		if (servType == null)
			return null;
		try {
			Class<?> cls = Class.forName(PACKAGEPATCH + servType + POSTFIX);
			Method m = cls.getMethod("validate", String.class);
			msg = String.valueOf(m.invoke(null));
		} catch (Exception e) {
			return null;
		}

		return msg;
	}

}
